This repository was archived by the owner on Nov 2, 2023. It is now read-only.
Open
Conversation
|
How about explicit opt-in via starring the repo? https://github.com/resume/resume.github.com/blob/master/js/githubresume.js#L112 |
Contributor
Author
|
@dfm: Does this look good to merge? |
Contributor
Author
|
@dfm: Ping |
ilystsov
reviewed
Oct 30, 2023
ilystsov
left a comment
There was a problem hiding this comment.
I've switched to using random.choices which can generate the list of characters in one call rather than iterating with a list comprehension.
I used an f-string to format the auth_url
Instead of just urllib.urlencode, I've used urllib.parse.urlencode. This is the more modern way of importing it, especially if you're using Python 3.
I used a more conventional way to define the dictionary params.
Comment on lines
+171
to
+182
| def opt_in_login(username): | ||
| state = "".join([random.choice(string.ascii_uppercase + string.digits) | ||
| for x in range(24)]) | ||
| flask.session["state"] = state | ||
| params = dict( | ||
| client_id=flask.current_app.config["GITHUB_ID"], | ||
| redirect_uri=flask.url_for(".opt_in_callback", username=username, | ||
| _external=True), | ||
| state=state, | ||
| ) | ||
| return flask.redirect("https://github.com/login/oauth/authorize?{0}" | ||
| .format(urllib.urlencode(params))) |
There was a problem hiding this comment.
Suggested change
| def opt_in_login(username): | |
| state = "".join([random.choice(string.ascii_uppercase + string.digits) | |
| for x in range(24)]) | |
| flask.session["state"] = state | |
| params = dict( | |
| client_id=flask.current_app.config["GITHUB_ID"], | |
| redirect_uri=flask.url_for(".opt_in_callback", username=username, | |
| _external=True), | |
| state=state, | |
| ) | |
| return flask.redirect("https://github.com/login/oauth/authorize?{0}" | |
| .format(urllib.urlencode(params))) | |
| def opt_in_login(username): | |
| state = ''.join(random.choices(string.ascii_uppercase + string.digits, k=24)) | |
| flask.session["state"] = state | |
| params = { | |
| 'client_id': flask.current_app.config["GITHUB_ID"], | |
| 'redirect_uri': flask.url_for('.opt_in_callback', username=username, _external=True), | |
| 'state': state, | |
| } | |
| auth_url = f"https://github.com/login/oauth/authorize?{urllib.parse.urlencode(params)}" | |
| return flask.redirect(auth_url) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.